package com.xmbandu.app.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.xmbandu.app.R;
import com.xmbandu.app.base.GlideApp;
import com.xmbandu.app.bean.BookListBean;
import com.xmbandu.app.utils.CommonUtils;

import java.util.List;

/**
 * Created by wmq on 2019-04-26.
 */
public class BookAdapter extends BaseQuickAdapter<BookListBean.ListBean, BaseViewHolder> {

    public BookAdapter(int layoutResId, @Nullable List<BookListBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BookListBean.ListBean item) {
        GlideApp.with(mContext)
                .asBitmap()
                .load(item.getPhoto() + "?imageView2/1/w/160/h/209")
                .override(CommonUtils.dip2px(mContext, 160), CommonUtils.dip2px(mContext, 209))
                .centerCrop()
                .placeholder(R.mipmap.list_nomal)
                .into((RoundedImageView) helper.getView(R.id.iv_book_item));
    }
}
